from crewai.flow.flow import Flow, start, listen

class BasicFlow(Flow):

    @start()
    def start_node(self):
        self.state["msg"] = "你好，这是开始节点"

    @listen(start_node)
    def second_node(self):
        print(f"第二个节点收到了: {self.state['msg']}")
        self.state["step_one"] = "这是第二个节点"

    @listen(second_node)
    def third_node(self):
        self.state["step_two"] = "这是第三个节点"
        return self.state

flow = BasicFlow()
flow.plot("basic_flow.png")
result = flow.kickoff()
print("流程最终输出:", result)
